package com.epower.bo.epowerkv.impl;


import javax.annotation.Resource;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.epower.base.BaseBO;
import com.epower.bo.epowerkv.EpowerKvService;
import com.epower.dao.epowerkv.EpowerKvDAO;
import com.epower.dataobject.EpowerKvDO;
import java.util.List;
/***
 * BO层实现类
 * @author QuickDev
 *
 */
@Scope("singleton")
@Component("epowerKvBO")
@Transactional(propagation=Propagation.SUPPORTS,readOnly=true)
public class EpowerKvServiceImpl extends BaseBO implements EpowerKvService {
    private EpowerKvDAO epowerKvDAO;

	
    /***
     * 
     */
	@Override
	public EpowerKvDO getEpowerKvByOption(EpowerKvDO epowerKv) {
		return epowerKvDAO.getEpowerKvByOption(epowerKv);
	}
    /***
     * 
     */
	@Override
	public List<EpowerKvDO> getEpowerKvListByOption(EpowerKvDO epowerKv) {
		return epowerKvDAO.getEpowerKvListByOption(epowerKv);
	}
	@Override
	public List<EpowerKvDO> getEpowerKvListPageByOption(EpowerKvDO epowerKv) {
    	int totalItem=getEpowerKvCountByOption(epowerKv);
		epowerKv.setTotalItem(totalItem);
		return epowerKvDAO.getEpowerKvListByOption(epowerKv); 
	}
    /***
     * 
     */
	@Override
	public EpowerKvDO getEpowerKvByKeyname(String keyname) {
		return epowerKvDAO.getEpowerKvByKeyname(keyname);
	}
	 /***
     * 
     */
	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public boolean deleteEpowerKvByKeyname(String keyname) {
		return epowerKvDAO.deleteEpowerKvByKeyname(keyname);
	}
    /***
     * 
     */
	@Override
	public Integer getEpowerKvCountByOption(EpowerKvDO epowerKv) {
		return epowerKvDAO.getEpowerKvCountByOption(epowerKv);
	}
    
    /***
     * 
     */
	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public boolean updateEpowerKvByOption(EpowerKvDO epowerKv) {
		return epowerKvDAO.updateEpowerKvByOption(epowerKv);
	}
    /***
     * 
     */
	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public String addEpowerKv(EpowerKvDO epowerKv) {
		try{
			String id= epowerKvDAO.addEpowerKv(epowerKv);
			return id;
		}catch (Exception e) {
				throw new RuntimeException("service is error");
		}
	}
    /***
     * 
     * @getter setter
     */
	public EpowerKvDAO getEpowerKvDAO() {
	    return epowerKvDAO;
	}
	@Resource
	public void setEpowerKvDAO(EpowerKvDAO epowerKvDAO) {
		this.epowerKvDAO = epowerKvDAO;
	}
	
}
